<!DOCTYPE html>
<html lang="en">
 <head>
  <meta charset="utf-8">
  <meta name="Author" content="Jenny.Zhan">
  <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
  <META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
  <META HTTP-EQUIV="Expires" CONTENT="0">
  <title>订单详情</title>
  <link rel="stylesheet" href="<{$ipath}>app/hotel/css/base.css">
  <link rel="stylesheet" href="<{$ipath}>app/hotel/css/layout.css">
</head>
<body>
<div class="boxwrap pd-t-0">
	<div class="local">当前位置 丨 酒店管理 > 订单详情</div>
	<div class="box">
		<h1 class="title">订单信息</h1>
		<div class="bd">
			<div class="process">
				<ul class="flow">
                    <{if $orderinfo.status=='1' || $orderinfo.status=='4' || $orderinfo.status=='5' || $orderinfo.status=='6'}>
					<li class="step-1-done"></li>
					<li class="step-2-done">
                        <!--<div class="arrow"></div>
                        <a href="" class="resend">重发确认信息</a>-->
					</li>
					<li class="step-3"></li>
					<li class="step-4 last"></li>
                    <{elseif $orderinfo.status=='2'}>
                    <li class="step-1-done"></li>
                    <li class="step-2-done">
                        <!--<div class="arrow"></div>
                        <a href="" class="resend">重发确认信息</a>-->
                    </li>
                    <li class="step-3-done"></li>
                    <li class="step-4 last"></li>
                    <{else}>
                    <li class="step-1-done"></li>
                    <li class="step-2-done">
                        <!--<div class="arrow"></div>
                        <a href="" class="resend">重发确认信息</a>-->
                    </li>
                    <li class="step-3-done"></li>
                    <li class="step-4-done last"></li>
                    <{/if}>
				</ul>
			</div>
		<!--	<div class="order-dashboard">
				<i class="step-point step-point-3-4"></i>
				<div class="bd">
					<ul class="status-list">
						<li class="latest">
							<span class="date">2015-01-03</span>
							<span class="week">周五</span>
							<span class="time">09:09:09</span>
							<span class="text">酒店已确认，您的房间预订成功</span>
						</li>
						<li>
							<span class="date"></span>
							<span class="week"></span>
							<span class="time">09:09:09</span>
							<span class="text">酒店已确认，您的房间预订成功</span>
						</li>
						<li>
							<span class="date">2015-01-03</span>
							<span class="week">周五</span>
							<span class="time">09:09:09</span>
							<span class="text">酒店已确认，您的房间预订成功</span>
						</li>
					</ul>
				</div>
			</div>  -->
			<div class="order-other pr">
				<ul>
					<li>
						<label>订单编号</label>
						<span class="o-txt"><{$orderinfo.order_sn}></span>
					</li>
					<li>
						<label>预订方式</label>
						<span class="o-txt">
                        <{if $orderinfo.status==1 && $orderinfo.source==1}>
                        预订
                    <{elseif $orderinfo.status==1 && $orderinfo.source==2}>
                        现付
                    <{elseif $orderinfo.status==2 && $orderinfo.source==2}>
                        现付
                    <{elseif $orderinfo.status==2 && $orderinfo.source==1 && $p_pay_type==1}>
                        预订
                    <{elseif $orderinfo.status==2 && $orderinfo.source==1 && $p_pay_type==2}>
                        预付
                    <{elseif $orderinfo.status==3 && $orderinfo.source==1 && $p_pay_type==1}>
                        预订
                    <{elseif $orderinfo.status==3 && $orderinfo.source==1 && $p_pay_type==2}>
                        预付
                    <{elseif $orderinfo.status==3 && $orderinfo.source==2}>
                        现付
                    <{elseif $orderinfo.status==4 || $orderinfo.status==5}>
                        预付
                    <{elseif $orderinfo.status==6 && $orderinfo.source==1 && $p_pay_type==2}>
                        预付
                    <{elseif $orderinfo.status==6 && $orderinfo.source==1 && $p_pay_type==1}>
                        预订
                    <{elseif $orderinfo.status==6 && $orderinfo.source==2}>
                        现付
                    <{elseif $orderinfo.status==7 && $orderinfo.source==1 && $p_pay_type==2}>
                        预付
                    <{elseif $orderinfo.status==7 && $orderinfo.source==1 && $p_pay_type==1}>
                        预订
                    <{elseif $orderinfo.status==7 && $orderinfo.source==2}>
                        现付
                    <{/if}>
                        </span>
					</li>
					<li>
						<label>预定日期</label>
						<span class="o-txt"><{$orderinfo.add_time}></span>
					</li>
					<li>
						<label>支付情况</label>
                        <span>
                        <{if $orderinfo.source==2 || ($orderinfo.source==1 && $p_pay_type==1)}>到店支付<{elseif $orderinfo.source==1 && $p_pay_type==2 && $orderinfo.status==4}>网上待支付<{elseif $orderinfo.source==1 && $p_pay_type==2 && ($orderinfo.status==5 || $orderinfo.status==6 || $orderinfo.status==2 || $orderinfo.status==7 || $orderinfo.status==3)}>网上已支付<{/if}>
                        </span>
                    </li>
					<li>
						<label>总金额</label>
						<span class="o-txt">￥<span class="corg"><{$orderinfo.amount}></span></span>
					</li>
                    <li>
                        <label>押金</label>
                        ￥<input type="text" value="<{$orderinfo.cash}>" <{if $orderinfo.status==2 || $orderinfo.status==6}>readonly="readonly"<{/if}> id="cash"><{if $orderinfo.status!=2 && $orderinfo.status!=6}><input type="button" onclick="setcash(<{$orderinfo.id}>)" value="保存"/><{/if}>
                    </li>
				</ul>
			<!--	<a href="" class="btn-basic-org pa btn-print">打印订单</a>  -->
                <{if $orderinfo.status=='1' || $orderinfo.status=='4' || $orderinfo.status=='5'}>
				<a href="javascript:void(0);" onclick="cancelorder(<{$orderinfo.id}>)" class="btn-basic-org pa btn-cancel">取消订单</a>
                <{/if}>
			</div>
		</div>
	</div>
	<div class="box">
		<h1 class="title">入住信息</h1>
		<div class="bd">
			<h3 class="hotel"><{$hinfo.name}><span class="h-address"><{$hinfo.address}></span></h3>
			<table class="tbl-basic" width="100%">
				<thead>
					<tr>
						<th width="18%">房型</th>
						<th width="18%">房号</th>
						<th width="18%">预订时间</th>
						<th width="18%">入住时间</th>
						<th>入住状态</th>
						<th>操作</th>
					</tr>
				</thead>
				<tbody>
                <{foreach from=$roominfo item=v key=k}>
					<tr>
						<td><{$v.typename}></td>
						<td><{$v.name}></td>
						<td><{$orderinfo.in_time}></td>
						<td><{$v.checktime}></td>
						<td><{if $v.rtype==2}>已入住<{/if}><{if $v.rtype==3}>未入住<{/if}><{if $v.rtype==1}>已退房<{/if}></td>
						<td>
                            <{if $v.rtype==3}>
							<a href="javascript:void(0);" onclick="checkIn(<{$orderinfo.id}>,<{$v.id}>)" class="corg">转入住</a>
							<a href="javascript:void(0);" onclick="cancelroom(<{$orderinfo.id}>,<{$v.id}>)" class="corg">取消房间</a>
                            <{/if}>
                            <{if $v.rtype==2}>
                            <a href="javascript:void(0);" class="view-layer" onclick="getroominfo(<{$orderinfo.id}>,<{$v.id}>)">查看</a>
                            <a href="javascript:void(0);" onclick="exitroom(<{$orderinfo.id}>,<{$v.id}>)" class="corg">退房</a>
                            <{/if}>
						</td>
					</tr>
                <{/foreach}>
				</tbody>
			</table>
		</div>
	</div>
	<div class="box">
		<h1 class="title">联系信息</h1>
		<div class="bd">
			<div class="order-other pr">
				<ul>
					<li>
						<label>联系手机</label>
						<span class="o-txt"><{$orderinfo.create_phone}></span>
					</li>
				</ul>
				<!--<a href="" class="btn-basic-org pa editinfo">修改联系信息</a>-->
			</div>
		</div>
	</div>
	<div class="box">
		<h1 class="title">酒店简介</h1>
		<div class="bd">
            <span class="order_right c-grey"><{$hinfo.intro1}></span>
		</div>
	</div>
</div>

<div class="layer_day popup">
    <div class="layer_top">
        <h3>客房信息</h3>
        <a href="javascript:;"><i id="floor_close" class="layer_close quxiao"></i></a></div>
    <form id="myform" method="post" action="?m=order&a=roomCheckIn">
        <div class="layer_inner">
            <div class="layer_foot">
                <ul class="layer_center">
                    <li>
                        <span>房型:<input type="text" id="r_type" readonly class="center-01" readonly="readonly"></span>
                    </li>
                    <li>房号:<input type="text" id="r_num" readonly name="rhao" class="center-01"></li>
                    <li>会员卡号:<input type="text" name="vip_num" class="center-02" readonly value="<{$orderinfo.vip_num}>"></li>
                </ul>
                <ul class="layer_center">
                    <li>房价:<input type="text" name="amount" id="layer_today_amount" class="center-01" readonly></li>
                    <li>折扣价:<input type="text" class="center-03" readonly></li>
                    <li><span>房价方案:</span>
                        <select name="proid" id="proid" class="center-04">
                        </select></li>
                </ul>
                <ul class="layer_center layer_center01">
                    <li>预入时间:<input type="text" readonly class="center-05" id="r_in_time" value="<{$orderinfo.in_time}>"></li>
                    <li class="day_num">预住天数:<span id="daySpan">0</span></li>
                    <li>预离时间:<input type="text" readonly class="center-05" id="r_out_time" value="<{$orderinfo.out_time}>"></li>
                </ul>
            </div>
            <div class="layer_box">
                <table width="100%" cellspacing="0" cellpadding="0" border="0">
                    <thead>
                    <tr>
                        <th class="w-100">姓名</th>
                        <th class="w-100">姓别</th>
                        <th class="w-150">出生年月</th>
                        <th class="w-100">证件类型</th>
                        <th class="num">证件号码</th>
                        <th class="w-100">操作</th>
                    </tr>
                    </thead>
                    <tbody>

                    <tr>
                        <td class="w-100"><input type="text" name="pername[]"></td>
                        <td><select name="persex[]">
                                <option value="">性别</option>
                                <option value="男">男</option>
                                <option value="女">女</option>
                            </select></td>
                        <td><input type="text" name="brithday[]"></td>
                        <td><select>
                                <option value="1">身份证</option>
                            </select></td>
                        <td><input type="text" name="pernum[]" class="num-01"></td>
                        <td onclick="removetr(this)" class="color"> 删除 </td>
                    </tr>
                    </tbody>
                </table>
                <span class="sign">+</span>
            </div>
            <div class="sum"><input type="submit" value="开房"> <a class="quxiao"/>关闭</a></div>
        </div>
        <input type="hidden" name="c_room_id" id="c_room_id"/>
        <input type="hidden" name="c_order_id" id="c_order_id"/>
    </form>
</div>
<div class="layer_day_view popup">
    <div class="layer_top">
        <h3>客房信息</h3>
        <a href="javascript:;"><i id="floor_close" class="layer_close quxiao"></i></a></div>
        <div class="layer_inner">
            <div class="layer_foot">
                <ul class="layer_center">
                    <li>房型: <label id="r_v_type"></label></li>
                    <li>房号: <label id="r_v_num"></label></li>
                    <li>会员卡号: <label><{$orderinfo.vip_num}></label></li>
                </ul>
                <ul class="layer_center">
                    <li>总价: <label id="r_v_amount"></label></li>
                    <li>折扣价: <label></label></li>
                    <li>房价方案: <label id="r_v_proid"></label></li>
                </ul>
                <ul class="layer_center layer_center01">
                    <li>预入时间: <label><{$orderinfo.in_time}></label></li>
                    <li>预住天数: <label id="r_v_daynum"></label></li>
                    <li>预离时间: <label><{$orderinfo.out_time}></label></li>
                </ul>
            </div>
            <div class="layer_box">

            </div>
        </div>

</div>
<div class="mask"></div>

<script src="http://test.s.zhongsou.com/app/hotel/js/jquery-1.9.1.min.js"></script>
<script src="<{$ipath}>app/hotel/js/mask.js"></script>
<script>
	$('.tbl-basic>tbody>tr:odd').addClass('zebra-bg');

    function checkIn(order_id,room_id){
        var url = "?m=order&a=getRoomInfoByid";
        var in_time = $('#r_in_time').val();
        var out_time = $('#r_out_time').val();
        var data = {
            'id':room_id,
            'in_time':in_time,
            'out_time':out_time
        };
        $.post(url,data,function(data){
            $('#r_type').val(data.tname);
            $('#r_num').val(data.name);
            $('#layer_today_amount').val(data.prices);
            $('#proid').html("<option value='"+data.pid+"'>"+data.pname+"</option>");
            $('#daySpan').html(data.daynum);
        },'json');
        $('#c_room_id').val(room_id);
        $('#c_order_id').val(order_id);
        //$(".layer_day").show();
	show(1,$(".layer_day"));
	middle($(".layer_day"));
    }

    function getroominfo(order_id,room_id){
        var url = "?m=order&a=getCheckInInfo";
        var in_time = $('#r_in_time').val();
        var out_time = $('#r_out_time').val();
        var data = {
            'room_id':room_id,
            'in_time':in_time,
            'out_time':out_time,
            'order_id':order_id
        };
        $.post(url,data,function(data){
            $('#r_v_type').html(data.tname);
            $('#r_v_num').html(data.name);
            $('#r_v_amount').html(data.prices);
            $('#r_v_proid').html(data.pname);
            $('#r_v_daynum').html(data.daynum);
            var html = '<table width="100%" cellspacing="0" cellpadding="0" border="0"><thead><tr><th class="w-100">姓名</th><th class="w-100">姓别</th><th class="w-150">出生年月</th><th class="w-100">证件类型</th><th class="num">证件号码</th></tr></thead><tbody>';
            for(var i=0;i<data.userinfo.length;i++){
                html+='<tr><td class="w-100">'+data.userinfo[i].name+'</td><td>'+data.userinfo[i].sex+'</td><td>'+data.userinfo[i].birth+'</td><td>身份证</td><td>'+data.userinfo[i].idnum+'</td></tr>';
            }
            html += '</tbody></table>';
            $(".layer_day_view .layer_box").html(html);
        },'json');
	show(1,$(".layer_day_view"));
 	middle($(".layer_day_view"));
   }

    function cancelroom(order_id,room_id){
        var url = '?m=order&a=cancelRoom&room_id='+room_id+'&order_id='+order_id;
        $.get(url,function(data){
            alert(data.msg);
            window.location.reload();
        },'json');
    }

    //取消订单
    function cancelorder(id){
        var url = '?m=order&a=cancelOrder&id='+id;
        $.get(url,function(data){
            if(data.stat==1){
                alert(data.msg);
                window.location.reload();
            }else{
                alert(data.msg);return;
            }
        },'json');
    }
    $(".sign").click(function(){
        var str='<tr><td><input type="text" name="pername[]"/></td><td><select name="persex[]"><option value="">性别</option><option value="男">男</option><option value="女">女</option></select></td><td><input type="text" name="brithday[]"/></td><td><select><option value="1">身份证</option></select></td><td><input type="text" class="num-01" name="pernum[]"/></td><td class="color" onclick="removetr(this)"> 删除 </td></tr>';
        $(".layer_box").find('table').append(str);
    });
    $('.quxiao').click(function(){
        $('.layer_day').hide();
	$('.mask').hide();
        $('#myform')[0].reset();
        $('#daySpan').html(0);
    });
    function removetr(obj){
        if($(".color").size()<=1){
            alert('请最少保留一个！');return;
        }
        $(obj).parent('tr').remove();
    }

    function exitroom(order_id,room_id){
        var url = '?m=order&a=exitroom&room_id='+room_id+'&order_id='+order_id;
        $.get(url,function(data){
            if(data.stat==1){
                alert(data.msg);
                window.location.reload();
            }else{
                alert(data.msg);return;
            }
        },'json');
    }

    function setcash(order_id){
        var url = '?m=order&a=setcash';
        var data = {
            'order_id':order_id,
            'cash':$('#cash').val()
        };
        $.post(url,data,function(data){
            if(data.stat==1){
                alert(data.msg);
                window.location.reload();
            }else{
                alert(data.msg);return;
            }
        },'json');
    }
    $('.view-layer').click(function(){
	show(1,$(".layer_day_view"));
    });
    $('.layer_day_view .quxiao').click(function(){
        $('.layer_day_view').hide();
	$('.mask').hide();
        $('.layer_day_view .layer_box tbody').remove();
    })
</script>
</body>
</html>